package com.stenio.fancat.controller.baby;

import com.stenio.fancat.controller.Result;
import com.stenio.fancat.domain.baby.BabyIconImage;
import com.stenio.fancat.form.baby.BabyIconImageForm;
import com.stenio.fancat.form.user.UserRelationshipForm;
import com.stenio.fancat.service.baby.BabyIconImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 宝宝头像接口
 */
@RestController
@RequestMapping("babyAccount")
public class BabyIconImageController {

    @Autowired
    private BabyIconImageService babyIconImageService;

    /**
     * 添加宝宝头像
     * @param file
     * @param userId
     * @return
     */
    @PostMapping("/insertBabyIcon")
    public Result<BabyIconImage> insertBabyIconImageByCondition(MultipartFile file,
                                                                String userId){
        Result<BabyIconImage> result = new Result<>();
        BabyIconImage babyIconImage = babyIconImageService.insertBabyIconImageByCondition(file,userId);
        result.setData(babyIconImage);
        result.setFlag(Result.FLAG.success);
        return result;
    }

    /**
     * 更改宝宝头像
     * @param file
     * @param userId
     * @return
     */
    @PostMapping("/modifyBabyIconImageByCondition")
    public Result<BabyIconImage> modifyBabyIconImageByCondition(MultipartFile file,
                                                                String userId){
        Result<BabyIconImage> result = new Result<>();
        BabyIconImage babyIconImage = babyIconImageService.modifyBabyIconImageByCondition(file,userId);
        result.setData(babyIconImage);
        result.setFlag(Result.FLAG.success);
        return result;
    }

    /**
     * 查询宝宝头像
     * @param userRelationshipForm
     * @return
     */
    /*@PostMapping("/queryBabyIconImageByCondition")
    public Result<BabyIconImage> queryBabyIconImageByCondition(@RequestBody UserRelationshipForm userRelationshipForm){
        Result<BabyIconImage> result = new Result<>();
        BabyIconImage babyIconImage = babyIconImageService.queryBabyIconImageByCondition(userRelationshipForm);
        result.setData(babyIconImage);
        result.setFlag(Result.FLAG.success);
        return result;
    }*/
}
